It is an undeniable fact that future service development trends towards all-IP (Internet Protocol, Internet protocol) networks. More and more carriers bear conventional telecommunication services and emerging services on an IP network, so as to acquire characteristics and advantages such as a new service, a high bandwidth utilization ratio, and a low cost. As a significant characteristic of the IP network, equal-cost multipath (Equal-Cost MultiPath, ECMP) greatly improves a resource utilization ratio of the IP network and balances a load of the IP network, but brings great difficulty to fault detection and location of the IP network.
The ECMP can make multiple equal-cost paths share an IP packet load sent from a source end to a destination end, so as to achieve the purpose of making the most of resources of a bearer network. The so-called equal-cost paths means that among multiple paths that exist between the source end and the destination end, if some paths have equal path overheads, for example, the same number of hops, these paths are equal-cost paths.
A router generally supports ECMP load sharing based on a 2-tuple (a source IP address and a destination IP address) and a 5-tuple (a source IP address, a destination IP address, a protocol number, a source port, and a destination port). In the ECMP load sharing of the 5-tuple, a router groups packets passing through the router, where packets having the same 5-tuple are grouped together, and designates one path for packets of each group according to a load sharing algorithm. In this way, if protocol numbers, source port numbers, or destination port numbers of packets sent from a same source end to a same destination end are different from each other, the packets may pass through different paths. In a network, represented by an ECMP network, where path selection is based on ports, for the packets from the same source end to the same destination end, routing can be performed according to a port pair formed of a source port number and a destination port number, so as to distribute traffic from the same source end to the same destination end.
However, when the network (for example, an ECMP network that performs load sharing by using the ECMP) where path selection is based on ports is faulty, due to a fact that different paths cannot be passed through based on ports in an existing network fault detection method, it is difficult to detect the fault and to locate the fault.
At present, a connectivity test may be performed by using a Ping command, so as to detect whether a network fault exists. When the Ping command is used, the source end sends an ICMP (Internet Control Message Protocol, internet control message protocol) echo request packet (type 8) to the destination end. When the destination end receives the ICMP echo request packet, the destination end returns an ICMP echo response packet (type 0), and the source end can calculate round-trip time and a packet loss rate. If the source end does not receive the ICMP echo response packet within a certain time, the source end determines that the destination end is unreachable and the IP network is faulty. Because Ping packets sent through the Ping command have a same source IP address and a same destination IP address and a same protocol number 1, but do not have a port number, the Ping packets sent from the source end to the destination end can only pass through a same path, and connectivity of only one path can be tested through the Ping packets. When another path is faulty, the Ping packet cannot sense and therefore cannot determine existence of the fault of the another path. Moreover, the Ping command cannot locate the fault.
A network fault may also be detected by using a bidirectional forwarding detection (Bidirectional Forwarding Detection, BFD) packet. The source end and the destination end periodically send to each other a BFD detection packet on a session channel established between the source end and the destination end. A protocol number of the BFD packet is 17, and a source port number and a destination port number of the BFD packet are both 3784. If the source end or the destination end does not receive a detection packet sent by the other party within a sufficiently long time, it is considered that the channel between the source end and the destination end is faulty. Because 5-tuples of BFD packets sent from one party to the other party are the same, in the network where path selection is based on ports, the BFD packet can pass through only one path, so that a fault of only one path can be detected, while faults of other equal-cost paths between the source end and the destination end cannot be detected. Meanwhile, a fault cannot be located by BFD either.
Furthermore, a path between the source end and the destination end may also be determined by using a Traceroute (traceroute) command, so as to find whether an fault exists on the path and where the fault is located. In a Traceroute operation, a TTL (time to live) field in an IP packet header is modified and an ICMP timeout packet is used, which can implement fault detection and location. The source end sends an ICMP echo request packet to the destination end by progressively increasing the TTL field. A router receiving the ICMP echo request packet reduces the TTL by 1, and if the router finds that the TTL is 0, the router discards the packet, and returns an ICMP timeout packet (type 11) to the source end. In this way, an address of a certain router may be obtained. If the address of the certain router is not obtained, it is considered that the router is faulty. However, although Traceroute packets sent from the source end to the destination end have a same source IP address, a same destination IP address, and a same protocol number (1), the packets have no source port number and no destination port number, so the Traceroute packets may also pass through only one path and a fault of only one path can be detected.
It can be seen that, in the foregoing relevant technologies, port numbers are not distinguished in a fault detection process, sent packets can only pass through a same path, so a fault of only one path can be detected, and faults of other paths between the source end and the destination end cannot be detected. In this way, in the network (for example, the ECMP network) where path selection is based on ports, a fault between the source end and the destination end cannot be effectively detected.